cmake_minimum_required(VERSION 3.5)
project(qrcode_new)

# 设置C++标准
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 查找依赖项
find_package(rclcpp REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(origincar_msg REQUIRED)
find_package(ai_msgs REQUIRED)
find_package(cv_bridge REQUIRED)
find_package(PkgConfig REQUIRED)
find_package(std_msgs REQUIRED)
pkg_check_modules(ZBAR REQUIRED zbar)



include_directories(
  ${OpenCV_INCLUDE_DIRS}
  ${rclcpp_INCLUDE_DIRS}
  ${sensor_msgs_INCLUDE_DIRS}
  ${origincar_msg_INCLUDE_DIRS}
  ${ZBAR_INCLUDE_DIRS}
)

add_executable(qrcode_new src/qrcode_new.cpp)

# 链接库
ament_target_dependencies(qrcode_new
  rclcpp
  geometry_msgs
  sensor_msgs
  origincar_msg
  ai_msgs
  cv_bridge
  OpenCV
  ZBAR
  std_msgs
)

# 链接库
target_link_libraries(qrcode_new
    ${OpenCV_LIBS}
    rclcpp::rclcpp
    #sensor_msgs::sensor_msgs  # 使用正确的库名称
    #origincar_msg::origincar_msg  # 使用正确的库名称
    ${ZBAR_LIBRARIES}
    ${cv_bridge_LIBRARIES}
)

install(TARGETS
  qrcode_new
  DESTINATION lib/${PROJECT_NAME}
)

# 导出依赖项
ament_export_dependencies(rclcpp sensor_msgs origincar_msg OpenCV)

# 安装配置文件
ament_package()
